<template>
  <div id="app">
    <van-tabbar route active-color="#cea62a" v-if="isTabShow">
      <van-tabbar-item replace to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item replace to="/topic" icon="aim">专题</van-tabbar-item>
      <van-tabbar-item replace to="/category" icon="qr">分类</van-tabbar-item>
      <van-tabbar-item replace to="/cart" icon="shopping-cart-o">购物车</van-tabbar-item>
      <van-tabbar-item replace to="/user" icon="friends-o">我的</van-tabbar-item>
      
    </van-tabbar>
    <router-view/>
  </div>
</template>

<script>
 
  export default {
    data() {
    return {
      isTabShow:true
    }
  },
  watch:{
    "$route":function (to) {
      var arr = ["home","topic","category","cart","user"]
      if(arr.includes(to.name)) {
          this.isTabShow = true
      } else {
        this.isTabShow = false
      }
    }
  }
  
  }
</script>
<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}


nav {
  padding: 30px;
  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
